﻿#include "xrtc/xrtc.h"

#include <rtc_base/logging.h>
#include <rtc_base/task_utils/to_queued_task.h>

#include "xrtc/base/xrtc_global.h"
// #include "xrtc/device/xrtc_render.h"
// #include "xrtc/media/chain/xrtc_preview.h"
#include "xrtc/media/base/xrtc_pusher.h"

namespace xrtc {

void XRTCEngine::Init(XRTCEngineObserver* observer) {
    rtc::LogMessage::LogTimestamps(true);
    rtc::LogMessage::LogThreads(true);
    rtc::LogMessage::LogToDebug(rtc::LS_VERBOSE);

    XRTCGlobal::Instance()->RegisterEngineObserver(observer);

    RTC_LOG(LS_INFO) << "XRTCSDK init";
}




XRTCPusher* XRTCEngine::CreatePusher(IVideoSource* video_source) {
    return XRTCGlobal::Instance()->api_thread()->Invoke<XRTCPusher*>(RTC_FROM_HERE, [=]() {
        return new XRTCPusher(video_source);
    });
}

} // namespace xrtc